package com.yami.shop.personnft.common.listener;

import com.yami.shop.bean.event.DelPersonnftEvent;
import com.yami.shop.common.util.Json;
import com.yami.shop.personnft.common.service.PersonNftApplyService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 确认订单信息时的默认操作
 *
 * @author LGH
 */
@Slf4j
@Component("delPersonnftListener")
@AllArgsConstructor
public class DelPersonnftListener {

    @Autowired
    private PersonNftApplyService personNftApplyService;
    /**
     * 购买持仓增加取币记录
     */
    @EventListener(DelPersonnftEvent.class)
//    @Async("lazyTraceExecutor")
    public void defaultBusinessAddPersonnListener(DelPersonnftEvent event) {
        log.info("划转完成删除持仓appids,{}", Json.toJsonString(event.getApplyIds()));
        personNftApplyService.chenAllBachIdDataResult(event.getApplyIds());
    }
}
